#include <stdio.h>
#include <stdlib.h>
int a[12]={31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, y, d, m, n, i, check;
int day_number(int d, int m, int y)
{
	if((y<=0)||(d<=0)||(m<=0)||(m>12)||(d>a[m-1])||((m==2)&&(d==29)&&((y%4!=0)||((y%100==0)&&(y%400!=0)))))
		{
			return -1;
		}
	if((d==29)&&(m==2))
		{
			return 60;
		}
	if(m==1)
		{
			return d;
		}
	if(((y%4!=0)||((y%100==0)&&(y%400!=0)))&&(m>2))
		{
			 check=-1;
		}
	else
		{
			check=0;
		}
	for(i=0; i<m-1; i++)
	{
		check=check+a[i];
	}
	return check+d;
}
void main()
{
	printf("Enter day, month and year with spaces between numbers:\n");
	check=scanf("%d %d %d", &d, &m, &y);
	if(check!=3)
		{
			printf("Wrong input!\n");
			system("PAUSE");;
			return;
		}
	if(day_number(d,m,y)==-1)
		{
			printf("Wrong input!\n");
			system("PAUSE");
			return;
		}
	else
		{
			printf("Day number: %d\n", day_number(d,m,y));
			system("PAUSE");
		}
}